package vno.fux.res.pool
{
	import vno.fux.res.manager.LoadState;
	import vno.fux.res.manager.ResourceManager;
	import flash.utils.Dictionary;

	public class PicButtonResource extends UiResource
	{
		use namespace RM_URM;
		RM_URM var _button:AutoBitmap;
		public function PicButtonResource(id_:uint)
		{
			super(id_);
		}
		public function get button():AutoBitmap
		{
			if(_loadStateDic[_button] == LoadState.NOT_LOAD)
			{
				_loadStateDic[_button] = LoadState.PRE_LOAD;
				ResourceManager.getInstance().ui.load(id);
			}
			return _button;
		}
		override public function create():void
		{
			this._loadStateDic = new Dictionary(true);
			_button = new AutoBitmap;
			this._loadStateDic[_button] = LoadState.NOT_LOAD;
		}
		
		override public function destroy():void
		{
			_button.detachAll();
			_button.dispose();
			_button = null;
			this._loadStateDic = null;
		}
	}
}